import 'package:ct_pa_majordomo/config/theme_vars.dart';
import 'package:flutter/material.dart';

class PreCheckInStatus {
  static const String PENDING = "0";    // 待审核
  static const String APPROVED = "1";   // 已审核
  static const String REJECTED = "2";   // 已驳回
  static const String CHECKED_IN = "4"; // 已入住

  static List<Map<String, String>> get statusList => [
    {"name": "全部", "value": ""},
    {"name": "待审核", "value": PENDING},
    {"name": "已审核", "value": APPROVED},
    {"name": "已驳回", "value": REJECTED},
    {"name": "已入住", "value": CHECKED_IN},
  ];

  static String getStatusText(String status) {
    switch (status) {
      case PENDING:
        return "待审核";
      case APPROVED:
        return "已审核";
      case REJECTED:
        return "已驳回";
      case CHECKED_IN:
        return "已入住";
      default:
        return "--";
    }
  }

  static Color getStatusColor(String status) {
    switch (status) {
      case PENDING:
        return ThemeVars.colorWarning;
      case APPROVED:
      case CHECKED_IN:
        return ThemeVars.colorSuccess;
      case REJECTED:
        return ThemeVars.colorError;
      default:
        return ThemeVars.colorTextSec;
    }
  }

  static Color getStatusBgColor(String status) {
    switch (status) {
      case PENDING:
        return ThemeVars.colorWarningLight;
      case APPROVED:
      case CHECKED_IN:
        return ThemeVars.colorSuccessLight;
      case REJECTED:
        return ThemeVars.colorErrorLight;
      default:
        return ThemeVars.colorBackground;
    }
  }

  static Widget buildStatusTag(String status) {
    return Container(
      padding: const EdgeInsets.symmetric(
        horizontal: 8,
        vertical: 2,
      ),
      decoration: BoxDecoration(
        color: getStatusBgColor(status),
        borderRadius: BorderRadius.circular(4),
      ),
      child: Text(
        getStatusText(status),
        style: TextStyle(
          color: getStatusColor(status),
          fontSize: 12,
        ),
      ),
    );
  }
} 